﻿using cludg.Infrastructure.Core.Attributes;
using cludg.Infrastructure.Core.Settings;
using nsadv.Statistic.Repository.NHibernate;

namespace nsadv.Statistic.Web.Bootstrappers
{
	public class UpdateDatabaseBootstrapper : Bootstrapper
	{
		protected readonly NHibernateController SessionController;

		[Dependency]
		public ISettings Settings { get; set; }

		public UpdateDatabaseBootstrapper(NHibernateController sessionController)
		{
			SessionController = sessionController;
		}

		public override void Execute()
		{
			if ((bool)Settings["Debug_UpdateDB"])
			{
				SessionController.UpdateDatabaseSchema();
			}
		}
	}
}